#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2022/4/7 10:12 上午
# @Author : wang
# @Email : 136697880@qq.com
# @File : account.py
# @Project : bugmgr
from django import forms
from . import models


class UserInfoForm(forms.ModelForm):
    password = forms.CharField(label='密码', widget=forms.PasswordInput)
    confirmPassword = forms.CharField(label='重复密码', widget=forms.PasswordInput)
    code = forms.CharField(label='验证码')

    class Meta:
        model = models.UserInfo
        fields = "__all__"

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        for name, field in self.fields.items():
            field.widget.attrs['class'] = 'form-control'
            field.widget.attrs['placeholder'] = '请输入{}'.format(field.label)
